package com.jumi.microservice.yzhpay.pay;

import com.jumi.microservice.yzhpay.constant.ConfigPath;
import com.jumi.microservice.yzhpay.dto.request.Request;
import com.jumi.microservice.yzhpay.util.OrderUtil;
import com.jumi.microservice.yzhpay.util.Property;

import java.util.Date;

public abstract class BasePay<T> {

    public Request assembleRequest() throws Exception {
        return Request.builder()
                .mess(OrderUtil.getMess())
                .timestamp(Integer.parseInt(String.valueOf(System.currentTimeMillis()/1000)))
                .sign_type(Property.getProperties(ConfigPath.YZH_SIGN_TYPE))
                .build().encData(assembleParam());
    }

    public abstract T assembleParam();

}
